#include "ProducerThread.hpp"
#include "ConsumerThread.hpp"
#include "TaskQueue.hpp"

#include <memory>

using std::unique_ptr;


int main()
{
    //创建了一个任务队列(流水线)
    wd::TaskQueue taskque(10);
    //创建一个生产者和一个消费者
    unique_ptr<wd::Thread> producer(new ProducerThread(taskque));
    unique_ptr<wd::Thread> consumer(new ConsumerThread(taskque));
    producer->start();
    consumer->start();

    producer->join();
    consumer->join();
    printf("main thread is exiting\n");//效率更高
    return 0;
}

